package com.dianping.cat.alarm.receiver.entity;

import com.dianping.cat.alarm.receiver.BaseEntity;
import com.dianping.cat.alarm.receiver.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;

public class AlertConfig
  extends BaseEntity<AlertConfig> {
/*  10 */   private Map<String, Receiver> m_receivers = new LinkedHashMap();



  private Boolean m_enable;




/*  19 */   public void accept(IVisitor visitor) { visitor.visitAlertConfig(this); }


  public AlertConfig addReceiver(Receiver receiver) {
/*  23 */     this.m_receivers.put(receiver.getId(), receiver);
    return this;
  }


  public boolean equals(Object obj) {
    if (obj instanceof AlertConfig) {
/*  30 */       AlertConfig _o = (AlertConfig)obj;

      if (!equals(getReceivers(), _o.getReceivers())) {
/*  33 */         return false;
      }

      if (!equals(getEnable(), _o.getEnable())) {
/*  37 */         return false;
      }


/*  41 */       return true;
    }

/*  44 */     return false;
  }


/*  48 */   public Receiver findReceiver(String id) { return (Receiver)this.m_receivers.get(id); }


  public Receiver findOrCreateReceiver(String id) {
/*  52 */     Receiver receiver = (Receiver)this.m_receivers.get(id);

/*  54 */     if (receiver == null) {
/*  55 */       synchronized (this.m_receivers) {
/*  56 */         receiver = (Receiver)this.m_receivers.get(id);

/*  58 */         if (receiver == null) {
/*  59 */           receiver = new Receiver(id);
/*  60 */           this.m_receivers.put(id, receiver);
        }
      }
    }

/*  65 */     return receiver;
  }


/*  69 */   public Boolean getEnable() { return this.m_enable; }



/*  73 */   public Map<String, Receiver> getReceivers() { return this.m_receivers; }







/*  87 */   public boolean isEnable() { return (this.m_enable != null && this.m_enable.booleanValue()); }



  public void mergeAttributes(AlertConfig other) {
/*  92 */     if (other.getEnable() != null) {
/*  93 */       this.m_enable = other.getEnable();
    }
  }


/*  98 */   public Receiver removeReceiver(String id) { return (Receiver)this.m_receivers.remove(id); }


  public AlertConfig setEnable(Boolean enable) {
/* 102 */     this.m_enable = enable;
/* 103 */     return this;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-alarm-3.0.0.jar!/com/dianping/cat/alarm/receiver/entity/AlertConfig.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */